#!/bin/sh -e

# $1 = version
TAR=../substance_$1.orig.tar.gz
ZIP=substance-all.zip
DIR=substance-$1.orig

wget https://substance.dev.java.net/files/documents/3294/67346/$ZIP

# clean up the upstream tarball
unzip -d $DIR $ZIP
tar -c -z -f $TAR -X debian/orig-tar.exclude $DIR
rm -rf $DIR $ZIP

# move to directory 'tarballs'
if [ -r .svn/deb-layout ]; then
  . .svn/deb-layout
  mv $TAR $origDir
  echo "moved $TAR to $origDir"
fi

exit 0
